home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 1998 November / IRIX 6.5.2 Base Documentation November 1998.img / usr / share / catman / u_man / cat1 / egrep.z / egrep
Text File  |  1998-10-20  |  5KB  |  133 lines

  1.  
  2.  
  3.  
  4. EEEEGGGGRRRREEEEPPPP((((1111))))                                                              EEEEGGGGRRRREEEEPPPP((((1111))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      egrep - search a file for a pattern using full regular expressions
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      eeeeggggrrrreeeepppp [options] full regular expression [file ...]
  13.  
  14. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  15.      _e_g_r_e_p (_e_x_p_r_e_s_s_i_o_n _g_r_e_p) searches files for a pattern of characters and
  16.      prints all lines that contain that pattern.  _e_g_r_e_p uses full regular
  17.      expressions (expressions that have string values that use the full set of
  18.      alphanumeric and special characters) to match the patterns.  It uses a
  19.      fast deterministic algorithm that sometimes needs exponential space.
  20.  
  21.      _e_g_r_e_p accepts full regular expressions as in _e_d(1), except for \\\\(((( and \\\\)))),
  22.      and except for \\\\<<<< and \\\\>>>>, with the addition of:
  23.  
  24.      1.    A full regular expression followed by ++++ that matches one or more
  25.            occurrences of the full regular expression.
  26.      2.    A full regular expression followed by ???? that matches 0 or 1
  27.            occurrences of the full regular expression.
  28.      3.    Full regular expressions separated by |||| or by a new-line that match
  29.            strings that are matched by any of the expressions.
  30.      4.    A full regular expression that may be enclosed in parentheses (((())))
  31.            for grouping.
  32.  
  33.      Be careful using the characters $$$$, ****, [[[[, ^^^^, |, ((((, )))), and \\\\ in _f_u_l_l
  34.      _r_e_g_u_l_a_r _e_x_p_r_e_s_s_i_o_n, because they are also meaningful to the shell.  It is
  35.      safest to enclose the entire _f_u_l_l _r_e_g_u_l_a_r _e_x_p_r_e_s_s_i_o_n in single quotes
  36.      ''''...''''.
  37.  
  38.      The order of precedence of operators is [[[[]]]], then ****????++++, then concatenation,
  39.      then |||| and new-line.
  40.  
  41.      If no files are specified, _e_g_r_e_p assumes standard input.  Normally, each
  42.      line found is copied to the standard output.  The file name is printed
  43.      before each line found if there is more than one input file.
  44.  
  45.      Command line options are:
  46.  
  47.      ----bbbb    Precede each line by the block number on which it was found.  This
  48.            can be useful in locating block numbers by context (blocks are 512
  49.            bytes long and number from 0).
  50.      ----cccc    Print only a count of the lines that contain the pattern.
  51.      ----hhhh    Suppresses printing of filenames when searching multiple files.
  52.      ----iiii    Ignore upper/lower case distinction during comparisons.
  53.      ----llll    Print the names of files with matching lines once, separated by
  54.            new-lines.  Does not repeat the names of files when the pattern is
  55.            found more than once.
  56.      ----nnnn    Precede each line by its line number in the file (first line is 1).
  57.      ----ssss    Silent mode.  No pattern matches or error messages are printed.
  58.            This option allows command expressions to check _e_g_r_e_p's exit status
  59.            without having to deal with output.
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. EEEEGGGGRRRREEEEPPPP((((1111))))                                                              EEEEGGGGRRRREEEEPPPP((((1111))))
  71.  
  72.  
  73.  
  74.      ----vvvv    Print all lines except those that contain the pattern.
  75.      ----eeee _s_p_e_c_i_a_l__e_x_p_r_e_s_s_i_o_n
  76.            Search for a _s_p_e_c_i_a_l _e_x_p_r_e_s_s_i_o_n (_f_u_l_l _r_e_g_u_l_a_r _e_x_p_r_e_s_s_i_o_n that
  77.            begins with a ----).
  78.      ----ffff _f_i_l_e
  79.            Take the list of _f_u_l_l _r_e_g_u_l_a_r _e_x_p_r_e_s_s_i_o_n_s from _f_i_l_e.
  80.  
  81. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  82.      ed(1), fgrep(1), grep(1), sed(1), sh(1).
  83.  
  84. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  85.      Exit status is 0 if any matches are found, 1 if none, 2 for syntax errors
  86.      or inaccessible files (even if matches were found).
  87.  
  88. BBBBUUUUGGGGSSSS
  89.      Ideally there should be only one _g_r_e_p command, but there is not a single
  90.      algorithm that spans a wide enough range of space-time tradeoffs.  Lines
  91.      are limited to BUFSIZ characters; longer lines are truncated.  BUFSIZ is
  92.      defined in ////uuuussssrrrr////iiiinnnncccclllluuuuddddeeee////ssssttttddddiiiioooo....hhhh....
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.